package com.pmcc.core.service;

import com.pmcc.core.entity.security.Dict;
import com.pmcc.core.repository.DictRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @program: basePlatform
 * @description:
 * @author: Mr.Xue
 * @create: 2020-03-25 16:31
 **/
@Service
@Transactional
public class DictService {

    @Autowired
    DictRepository dictRepository;



    public String queryDictRemark(String code, String value) {
        List<Dict> pList = dictRepository.findByCode(code);
        if (pList.size() > 0) {
            List<Dict> list = dictRepository.findByParentIdAndCodeAndDelFlag(pList.get(0).getId(), value, "0");
            if (list != null && list.size() > 0) {
                return list.get(0).getRemark();
            } else {
                return null;
            }
        }
        return null;
    }
}
